package com.hd.openapi.web.cotenollen;

import com.hd.openapi.common.ResponseResult;
import com.hd.openapi.common.ResultTable;
import com.hd.openapi.entity.Customer;
import com.hd.openapi.entity.Recharge;
import com.hd.openapi.servies.pageroleser;
import com.hd.openapi.servies.rechargeser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/recharge")
public class rechargeconllen {
    @Autowired
    private rechargeser rs;

    @RequestMapping("/table")
    public ResultTable table(@RequestParam(defaultValue = "1") Integer page,
                             @RequestParam(defaultValue = "10") Integer limit
                             ){
        return rs.getalldata(page,limit);
    }
    @RequestMapping("/del")
    public ResponseResult del(Integer[] ids){
        return rs.deldat(ids);
    }
    @RequestMapping("/tree")
    public List<Customer> tree(){
        return rs.getall();
    }

    @RequestMapping("/add")
    public ResponseResult add(Recharge recharge){
        return rs.adddata (recharge);
    }
    @RequestMapping("/update")
    public ResponseResult update(Recharge recharge){
        return rs.updatada(recharge);
    }
}
